package com.un.ebs.contract.dto;

import com.un.ebs.contract.enums.ContractItemChangeTypeEnum;
import lombok.Data;

/**
 * <p>
 *
 * </p>
 *
 * @author liubo
 * @create 2021-04-21 11:14
 */
@Data
public class ContractItemChangeInfo {

    private String code;

    private String skuId;

    private String skuCode;

    private String skuName;

    private Double sourceQty;

    private Double newQty;

    private Double sourcePrice;

    private Double newPrice;

    private ContractItemChangeTypeEnum changeType;

    public static ContractItemChangeInfo buildDeleteItem(String code, String skuId, String skuCode, String skuName, Double price, Double qty) {
        ContractItemChangeInfo obj = new ContractItemChangeInfo();
        obj.setCode(code);
        obj.setSkuId(skuId);
        obj.setSkuCode(skuCode);
        obj.setSkuName(skuName);
        obj.setSourcePrice(price);
        obj.setSourceQty(qty);
        obj.setNewPrice(price);
        obj.setSourceQty(qty);
        obj.setChangeType(ContractItemChangeTypeEnum.DeleteItem);
        return obj;
    }

    public static ContractItemChangeInfo buildPriceChange(String code, String skuId, String skuCode, String skuName, Double price, Double qty, Double newPrice) {
        ContractItemChangeInfo obj = new ContractItemChangeInfo();
        obj.setCode(code);
        obj.setSkuId(skuId);
        obj.setSkuCode(skuCode);
        obj.setSkuName(skuName);
        obj.setSourcePrice(price);
        obj.setSourceQty(qty);
        obj.setNewPrice(newPrice);
        obj.setNewQty(qty);
        obj.setChangeType(ContractItemChangeTypeEnum.ChangePrice);
        return obj;
    }

    public static ContractItemChangeInfo buildQtyChange(String code, String skuId, String skuCode, String skuName, Double price, Double qty, Double newQty) {
        ContractItemChangeInfo obj = new ContractItemChangeInfo();
        obj.setCode(code);
        obj.setSkuId(skuId);
        obj.setSkuCode(skuCode);
        obj.setSkuName(skuName);
        obj.setSourcePrice(price);
        obj.setSourceQty(qty);
        obj.setNewPrice(price);
        obj.setNewQty(newQty);
        obj.setChangeType(ContractItemChangeTypeEnum.ChangeQty);
        return obj;
    }

    public static ContractItemChangeInfo buildPriceAndQtyChange(String code, String skuId, String skuCode, String skuName, Double price, Double qty, Double newPrice, Double newQty) {
        ContractItemChangeInfo obj = new ContractItemChangeInfo();
        obj.setCode(code);
        obj.setSkuId(skuId);
        obj.setSkuCode(skuCode);
        obj.setSkuName(skuName);
        obj.setSourcePrice(price);
        obj.setSourceQty(qty);
        obj.setNewPrice(newPrice);
        obj.setNewQty(newQty);
        obj.setChangeType(ContractItemChangeTypeEnum.ChangePrice);
        return obj;
    }

    public static ContractItemChangeInfo buildAddItem(String code, String skuId, String skuCode, String skuName, Double price, Double qty) {
        ContractItemChangeInfo obj = new ContractItemChangeInfo();
        obj.setCode(code);
        obj.setSkuId(skuId);
        obj.setSkuCode(skuCode);
        obj.setSkuName(skuName);
        obj.setSourcePrice(price);
        obj.setSourceQty(qty);
        obj.setNewPrice(price);
        obj.setNewQty(qty);
        obj.setChangeType(ContractItemChangeTypeEnum.NewItem);
        return obj;
    }

    public static ContractItemChangeInfo buildNotChange(String code, String skuId, String skuCode, String skuName, Double price, Double qty) {
        ContractItemChangeInfo obj = new ContractItemChangeInfo();
        obj.setCode(code);
        obj.setSkuId(skuId);
        obj.setSkuCode(skuCode);
        obj.setSkuName(skuName);
        obj.setSourcePrice(price);
        obj.setSourceQty(qty);
        obj.setNewPrice(price);
        obj.setNewQty(price);
        obj.setChangeType(ContractItemChangeTypeEnum.None);
        return obj;
    }
}
